package com.bw.module_service.http

import com.bw.lib_net.http.BaseResponse
import com.bw.module_service.model.AddVipModel
import com.bw.module_service.model.AnnouncementModelItem
import com.bw.module_service.model.CarModel
import com.bw.module_service.model.GetSignInfoModel
import com.bw.module_service.model.InspectionModel
import com.bw.module_service.model.InspectionModelItem
import com.bw.module_service.model.ParkSpaceModel
import com.bw.module_service.model.ParkSpaceModelItem
import com.bw.module_service.model.ProvinceModel
import com.bw.module_service.model.SignModel
import com.bw.module_service.model.TaskEntity
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path

interface ServiceApi {

    //根据车位类型获取车位信息
    @GET("/api/parking-spaces/type/{spaceType}")
    suspend fun getParkSpace(@Path("spaceType") spaceType: String): BaseResponse<ParkSpaceModel>

    //添加车位
    @POST("/api/parking-spaces")
    suspend fun addParkSpace(@Body body: RequestBody): BaseResponse<ParkSpaceModelItem>

    //删除车位
    @DELETE("/api/parking-spaces/{id}")
    suspend fun deleteParkSpace(@Path("id") id: Int): BaseResponse<Boolean>

    //根据ID获取车辆信息
    @GET("/api/vehicles/{id}")
    suspend fun getCar(@Path("id") id: Int): BaseResponse<CarModel>

    //根据车牌号获取车辆信息
    @GET("/api/vehicles/license/{licensePlate}")
    suspend fun byNumGetCar(@Path("licensePlate") licensePlate: String): BaseResponse<CarModel>

    //删除车辆
    @DELETE("/api/vehicles/{id}")
    suspend fun deleteCar(@Path("id") id: Int): BaseResponse<Boolean>

    //添加车辆
    @POST("/api/vehicles")
    suspend fun addCar(@Body body: RequestBody): BaseResponse<CarModel>

    //获取省份简码
    @GET("/api/vehicles/getProvinces}")
    suspend fun getProvinces(): BaseResponse<ProvinceModel>

    //修改车辆信息
    @PUT("/api/vehicles/{id}")
    suspend fun updateCar(@Path("id") id: Int, @Body body: RequestBody): BaseResponse<CarModel>


    @GET("/api/patrol-points")
    suspend fun getPatrolPoints(): BaseResponse<InspectionModel>

    @GET("/api/attendances/user/{userId}")
    suspend fun getSignInfo(@Path("userId") userId: Int): BaseResponse<GetSignInfoModel>

    @POST("/api/attendances")
    suspend fun getSign(@Body body: RequestBody): BaseResponse<SignModel>

    //根据id获取点位详情
    @GET("/api/patrol-points/{id}")
    suspend fun getPollingDetailById(@Path("id") id: Int): BaseResponse<InspectionModelItem>

    //创建点位
    @POST("/api/patrol-points")
    suspend fun addPolling(@Body body: RequestBody): BaseResponse<InspectionModelItem>


    @POST("/memberships")
    suspend fun addVip(@Body body: RequestBody): AddVipModel

    @GET("/memberships/{userId}")
    suspend fun getVipInfo(@Path("userId") userId: Int): AddVipModel

    @GET("/api/patrol-tasks")
    suspend fun getTaskList(): BaseResponse<List<TaskEntity>>



    //公告
    @GET("/api/announcements?page=0&size=500")
    suspend fun getAnnouncement(): BaseResponse<List<AnnouncementModelItem>>

    @POST("/api/announcements")
    suspend fun postAnnouncement(@Body body: RequestBody): BaseResponse<AnnouncementModelItem>

}